#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int n, a[1000], max = 0, max_num = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; i++)
    {
        int count = 0;
        for (int j = 0; j < n; j++)
        {
            if (a[j] == a[i])
            {
                count++;
            }
        }
        if (count > max)
        {
            max = count;
            max_num = a[i];
        }
    }
    printf("%d %d", max_num, max);
    return 0;
}